home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Languages / Quick C 2.0 / INCLUDE / ASSERT.H next >
Encoding:
C/C++ Source or Header  |  1988-12-05  |  939 b   |  53 lines

  1. /***
  2. *assert.h - define the assert macro
  3. *
  4. *    Copyright (c) 1985-1989, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *    Defines the assert(exp) macro.
  8. *    [ANSI/System V]
  9. *
  10. ****/
  11.  
  12.  
  13. #ifndef NO_EXT_KEYS    /* extensions enabled */
  14.     #define _CDECL    cdecl
  15.     #define _NEAR    near
  16. #else            /* extensions not enabled */
  17.     #define _CDECL
  18.     #define _NEAR
  19. #endif /* NO_EXT_KEYS */
  20.  
  21. #undef    assert
  22.  
  23. #ifdef NDEBUG
  24.  
  25. #define assert(exp)
  26.  
  27. #else
  28.  
  29. #ifdef    _QC
  30.  
  31. #define assert(exp) { \
  32.     if (!(exp)) { \
  33.         void _CDECL _assert(void *, void *, unsigned); \
  34.             extern int __aDBswpflg; \
  35.         extern int _aDBdoswp; \
  36.         if (__aDBswpflg == (int) &_aDBdoswp) _asm { int 3 } ; \
  37.         _assert(#exp, __FILE__, __LINE__); \
  38.         } \
  39.     }
  40.  
  41. #else
  42.  
  43. #define assert(exp) { \
  44.     if (!(exp)) { \
  45.         void _CDECL _assert(void *, void *, unsigned); \
  46.         _assert(#exp, __FILE__, __LINE__); \
  47.         } \
  48.     }
  49.  
  50. #endif    /* QC */
  51.  
  52. #endif /* NDEBUG */
  53.